﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics.Metrics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;

namespace 畜牧业审核程序国产.Models.SimpleFactory
{
    internal abstract class Animal
    {
        public abstract string[] ArrIndicators { get; }
        //以下为1到本季度的下一级显示的汇总内容
        public abstract DataTable GetDTAllIndicatorsOfSubordinateThisYearByCity(string[] tableNames,int 期别季);
        public abstract DataTable GetDTAllIndicatorsOfSubordinateThisYearByCountry(KeyValuePair<string,string> selectedCity, string[] tablesNames,int 期别季);
        public abstract DataTable GetDTAllIndicatorsOfSubordinateThisYearByTown(KeyValuePair<string,string>selectedCountry, string[] tableNames, int 期别季);
        //以下是本季度的下一级显示的汇总内容
        public abstract DataTable GetDTAllIndicatorsOfSubordinateThisSeasonByCity();
        public abstract DataTable GetDTAllIndicatorsOfSubordinateThisSeasonByCountry(KeyValuePair<string,string> selectedCity);
        public abstract DataTable GetDTAllIndicatorsOfSubordinateThisSeasonByTown(KeyValuePair<string,string>selectedCountry);
        //以下是一到本季度的全部养殖户内容
        public abstract DataTable GetDTOfAllFarmersThisYearOfProvince(string[] tableNames, int 期别季);
        public abstract DataTable GetDTOfAllFarmersThisYearOfCity(KeyValuePair<string, string> selectedCity,string[] tableNames,int 期别季);
        public abstract DataTable GetDTOfAllFarmersThisYearOfCountry(KeyValuePair<string, string> selectedCountry, string[] tableNames, int 期别季);
        public abstract DataTable GetDTOfAllFarmersThisYearOfTown(KeyValuePair<string, string> selectedTown, string[] tableNames, int 期别季);

        //以下是本季度显示全部养殖户的内容
        public abstract DataTable GetDTAllIndicatorsOfAllOwnersLocalThisSeasonByCity();
        public abstract DataTable GetDTAllIndicatorsOfAllOwnersLocalThisSeasonByCountry(KeyValuePair<string ,string> selectedCity);
        public abstract DataTable GetDTAllIndicatorsOfAllOwnersLocalThisSeasonByTown(KeyValuePair<string,string> selectedCountry);
        public abstract DataTable GetDTAllIndicatorsOfAllOwnersLocalThisSeasonOfASelectedTown(KeyValuePair<string, string> selectedTown);
        //以下是单项指标的内容SingleIndicator
        public abstract DataTable GetDTSingleIndicatorOfSubordinateThisSeasonByCity(KeyValuePair<string, string> Indicator);
        public abstract DataTable GetDTSingleIndicatorOfSubordinateThisSeasonByCountry(KeyValuePair<string,string>selectedCity, KeyValuePair<string, string> Indicator);
        public abstract DataTable GetDTSingleIndicatorOfSubordinateThisSeasonByTown(KeyValuePair<string,string>selectedCountry, KeyValuePair<string, string> Indicator);
        public abstract DataTable GetDTSingleIndicatorOfSubordinateThisSeasonOfASelectedTown(KeyValuePair<string, string> selectedTown, KeyValuePair<string, string> Indicator);
        /// <summary>
        /// 把所有指标都改成sum([指标名称]) as [规模户指标名称]的形式并用,隔开
        /// </summary>
        /// <returns></returns>
        public string GetSumStrAllIndicatorsJoin()
        {
            List<string> ListStrSumAllIndicators = new List<string>();
            for (int i = 0; i < ArrIndicators.Length; i++)
            {
                ListStrSumAllIndicators.Add($"SUM([{ArrIndicators[i]}]) as [规模户{ArrIndicators[i]}]");
            }
            string StrAllIndicatorsJoin = string.Join(",", ListStrSumAllIndicators);
            return StrAllIndicatorsJoin;
            //string sqlForGetAllIndicators = null;
        }
        /// <summary>
        /// 把所有指标用[]括起来并用,分隔
        /// </summary>
        /// <returns></returns>
        public string GetNameAllIncatorsJoin()
        {
            List<string> ListStrForAllIndicatorsName = new List<string>();
            for (int i = 0; i < ArrIndicators.Length; i++)
            {
                ListStrForAllIndicatorsName.Add($"[{ArrIndicators[i]}]");
            }
            string StrAllIndicatorsNameJoin = string.Join(",", ListStrForAllIndicatorsName);
            return StrAllIndicatorsNameJoin;
        }
    }
}
